<div ng-controller="itemManageCtrl">
    <ol class="breadcrumb">
        <li><a href="javascript:void(0)">系统管理</a></li>
        <li>字典管理管理</li>
    </ol>
    <div class="content-container">
        <div class="query">
            <div class="row">
                <form>
                    <div class="col-lg-1">
                    <div class="input-group input-group-sm">
                        <select class="form-control" ng-model="conditions.type">
                            <option value="">类型</option>
                            <option value="期数">期数</option>
                            <option value="客户属性">客户属性</option>
                            <option value="进件文件">进件文件</option>
                            <option value="预审结果">预审结果</option>
                            <option value="终审结果">终审结果</option>
                            <option value="所属城市">所属城市</option>
                            <option value="上牌人情况">上牌人情况</option>
                        </select>
                    </div>
                    </div>
                    <div class="col-lg-1">
                        <div class="input-group input-group-sm text-right">
                            <button class="btn btn-primary query-btn" ng-click="query()">查询</button>
                        </div>
                    </div>
                    <div class="col-lg-1">
                        <div class="input-group input-group-sm text-right">
                            <button class="btn btn-success query-btn" ng-click="add()">添加</button>
                        </div>
                    </div>
                    <div class="col-lg-1">
                        <div class="input-group input-group-sm text-right">
                            <button class="btn btn-default query-btn" ng-click="clearQuery()">清除</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="row page-result" ng-show="data.length > 0">
            <div class="col-lg-6">
                符合您的查询结果共有
                <label class="text-danger" ng-bind="total"></label>条
            </div>
            <div class="col-lg-6">
                <div class="pagination-size">
                    <select ng-change="changePageSize()" class="form-control input-sm" ng-options="option.name for option in page_size_arr track by option.value" ng-model="page_size">
                    </select>
                </div>
                <ul uib-pagination total-items="total" ng-model="conditions.page" max-size="5" class="pagination-sm pull-right" boundary-link-numbers="true" previous-text="上一页" next-text="下一页" items-per-page="conditions.rows" ng-change="query()"></ul>
            </div>
        </div>
        <div class="datagrid">
            <table class="table table-bordered" ng-show="data.length > 0">
                <tr>
                    <th style="width:5%;">序号</th>
                    <th style="width:25%;">类型</th>
                    <th style="width:20%;">键</th>
                    <th style="width:20%;">值</th>
                    <th style="width:30%;">操作</th>
                </tr>
                <tr ng-repeat="key in data" ng-click="selectRow(key)" ng-class="{'bg-info' : key.selected}">
                    <td>{{$index+1+(conditions.page-1)*conditions.rows}}</td>
                    <td>{{key.type}}</td>
                    <td>{{key.keyword}}</td>
                    <td>{{key.value}}</td>
                    <td>
                        <button class="btn btn-success btn-sm" ng-click="update(key)"><span class="glyphicon glyphicon-pencil top-2 right-2"></span>修改</button>
                        <button class="btn btn-danger btn-sm" ng-click="delete(key.id)"><span class="glyphicon glyphicon-remove top-2 right-2"></span>删除</button>
                    </td>
                </tr>
            </table>
            <div ng-show="data.length == 0" class="alert alert-warning">
                <span class="glyphicon glyphicon-info-sign"></span>&nbsp;查无相关数据，请重新查询！
            </div>
        </div>
    </div>
    <div alert title="alert.title" content="alert.content" open="alert.open"></div>
</div>
<!-- end controller -->
<script type="text/ng-template" id="add.html">
<div class="modal-header">
     <button type="button" class="close" ng-click="cancel()"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
    <h3 class="modal-title" id="modal-title">车型基本信息{{title}}</h3>
</div>
<form name="form" novalidate ng-submit="ok(form.$valid)">
<div class="modal-body modal-min-height" id="modal-body">
    <div class="form-horizontal">
        <div class="form-group">
            <span class="col-sm-3 remove-padding control-label"><em class="text-require">*</em>类型：</span>
            <div class="col-sm-9">
                <select class="form-control" ng-model="item.type" required>
                    <option value="期数">期数</option>
                    <option value="客户属性">客户属性</option>
                    <option value="进件文件">进件文件</option>
                    <option value="预审结果">预审结果</option>
                    <option value="终审结果">终审结果</option>
                    <option value="所属城市">所属城市</option>
                    <option value="上牌人情况">上牌人情况</option>
                </select>
                <p ng-show="form.type.$invalid  && form.type.$dirty" class="invalid">请填写类型</p>
            </div>
        </div>
        <div class="form-group">
            <span class="col-sm-3 remove-padding control-label"><em class="text-require">*</em>键：</span>
            <div class="col-sm-9">
                <input type="text" class="form-control" ng-model="item.keyword" placeholder="键" name="keyword" required>
                <p ng-show="form.keyword.$invalid  && form.keyword.$dirty" class="invalid">请填写键</p>
            </div>
        </div>
        <div class="form-group">
            <span class="col-sm-3 remove-padding control-label"><em class="text-require">*</em>值：</span>
            <div class="col-sm-9">
                <input type="number" class="form-control" ng-model="item.value" placeholder="值" name="value" required>
                <p ng-show="form.value.$invalid  && form.value.$dirty" class="invalid">请填写值</p>
            </div>
        </div>
    </div>
</div>
<div class="modal-footer">
    <button class="btn btn-primary" type="submit" ng-disabled="form.$invalid">确定</button>
    <button class="btn btn-default" type="button" ng-click="cancel()">取消</button>
</div>
</form>